<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http://www.renren.com/2009/xnml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="{{ staticUrl }}/img/favicon.ico" rel="itgeeker favorite icon" type="image/x-icon" />
    <link href="{{ staticUrl }}/css/layout.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{ staticUrl }}/css/profile.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{ staticUrl }}/css/editpaper.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <title>ITGeeker——编辑 {{ title }}</title>
    <script type="text/javascript" src="{{ staticUrl }}/js/base.js?ver={{ jsVersion }}"></script>
    <script type="text/javascript" src="{{ staticUrl }}/js/mathml.js?ver={{ jsVersion }}"></script>
    <script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
        function savePaper(status) {
            var paperForm = $("paper_form");
            if (paperForm) {
                var statusInput = $("status");
                if (statusInput) {statusInput.value = status.toString();}
                paperForm.submit();
            }
        }
    </script>
    <script type="text/javascript">
        tinyMCE.init({
            theme : "advanced",
            mode : "exact",
            elements: "paper_content",
            language : "zh",
            width : "618",
            height:"450",
            entity_encoding : "raw",
            save_callback: "mathmlDecode",
            valid_elements : "{{ tinymceValidElements }}",
            theme_advanced_buttons1:'bold,italic,underline,separator,forecolor,backcolor,emotions,separator,image{% if isAdministrator %},code{% endif %},separator,fontselect,fontsizeselect',
            theme_advanced_buttons2 : "justifyleft,justifycenter,bullist,numlist,separator,link,unlink,sub,sup",
            theme_advanced_buttons3 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_path : false,
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true,
            theme_advanced_resize_horizontal : false,
            theme_advanced_resizing_use_cookie : 1,
            theme_advanced_more_colors : false,
            theme_advanced_font_sizes : '3,4,5,6,7',
            theme_advanced_fonts:'楷体_GB2312=楷体_GB2312;黑体=黑体;隶书=隶书;Times New Roman=Times New Roman;Arial=Arial;',
            custom_undo_redo : false,
            convert_urls : false
        });
    </script>
</head>
<body>
    {% include "inc/top_bar.inc" %}
    <div class="content_wrapper">
        <div id="content" class="content">
            {% if needReOpen %}
                <p class="err_msg">发生严重错误，保存失败，原因可能是你输入了非法内容或公式格式有误，请<a href="/editpaper?op=edit&pid={{ pid }}">重新打开</a>该文章继续编辑！</p>
            {% else %}
                {% if errMsg %}
                    <p class="err_msg">{{ errMsg }}</p>
                {% endif %}
                <div class="profile_left">
                    <form method="post" action="/editpaper" id="paper_form">
                        <input type="hidden" name="op" value="{{ op }}"/>
                        {% if pid %}
                            <input type="hidden" name="pid" value="{{ pid }}"/>
                        {% endif %}
                        <p>
                            <label class="title-label" for="title">标题</label>
                            <input class="input-text" id="paper_title" name="title" type="text" value="{{ title }}" />
                        </p>
                        <p>
                            <label class="title-label" for="category">文章分类</label>
                            <select class="input-select" id="category" name="category">
                                <option value="invalid"> </option>
                                {% for cat in paperCategoryList %}
                                    {% ifnotequal cat.catValue 'all' %}
                                        {% ifnotequal cat.catValue 'more' %}
                                            <option value="{{ cat.catValue }}" {% ifequal cat.catValue category %}selected="selected"{% endifequal %}>{{ cat.catText }}</option>
                                        {% endifnotequal %}
                                    {% endifnotequal %}
                                {% endfor %}
                            </select>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="paper_time" target="_blank" href="{{ sysPaperUrlHowToInputFormula }}">如何输入公式？</a>
                        </p>
                        <p>
                            <textarea id="paper_content" name="content" cols="50" rows="15">{{ content }}</textarea>
                        </p>
                        <p>
                            <input id="status" type="hidden" name="status" value="{{ paperStatusDraft }}" />
                            <input id="publishBtn" type="button" value="保存并发布" class="input-button" onclick="savePaper({{ paperStatusNormal }});" />&nbsp;&nbsp;&nbsp;&nbsp;<input id="draftBtn" type="button" value="存为草稿" class="input-button" onclick="savePaper({{ paperStatusDraft }});" />
                        </p>
                    </form>
                </div>
            {% endif %}
            <div class="profile_right">
            </div>
            <div style="clear:both"></div>
        </div>
    </div>
    {% include "inc/footer.inc" %}
</body>
</html>
